<?php
/**
 * PsiFramework
 *
 * Php Simple Framework
 *
 * PHP version 5.3
 *
 * @category  PsiFramework.Plugins.Form.Classes.Model
 * @package   PsiFramework.Plugins.Form.Classes.Model
 * @author    Remi San <remi.san@gmail.com>
 * @copyright 2011 Remi San
 * @license   http://creativecommons.org/licenses/by/3.0/  Creative Commons CC BY 3.0
 * @version   SVN: <svn_id>
 * @link      http://www.psiframework.com/phpdoc/classes/db_\PsiFramework\Plugins\Form\Classes\Model\FormFieldLink.html
 */

namespace PsiFramework\Plugins\Form\Classes\Model;

import("Classes.Model.Object");
import("Plugins.Form.Classes.Model.Form");
import("Plugins.Form.Classes.Model.FormField");

use \PsiFramework\Classes\Model\Object;
use \PsiFramework\Plugins\Form\Classes\Model\Form;
use \PsiFramework\Plugins\Form\Classes\Model\FormField;

/**
 * The FormFieldLink Object
 *
 * This is the class for the FormFieldLink Object
 *
 * @category PsiFramework.Plugins.Form.Classes.Model
 * @package  PsiFramework.Plugins.Form.Classes.Model
 * @author   Remi San <remi.san@gmail.com>
 * @license  http://creativecommons.org/licenses/by/3.0/  Creative Commons CC BY 3.0
 * @link     http://www.psiframework.com/phpdoc/classes/db_\PsiFramework\Plugins\Form\Classes\Model\FormFieldLink.html
 */
class FormFieldLink extends Object
{
    /**
     * @var Form
     */
    protected /*Form*/      $_form ;
    /**
     * @var FormField
     */
    protected /*FormField*/ $_field ;
    /**
     * @var int
     */
    protected /*int*/       $_order ;
    /**
     * @var string
     */
    protected /*string*/    $_groupName ;
    /**
     * @var string
     */
    protected /*string*/    $_groupTitle ;

    /**
     * Constructor
     * 
     * @param Form      $form       The form
     * @param FormField $field      The field
     * @param int       $order      The order
     * @param string    $groupName  The group
     * @param string    $groupTitle The group
     * 
     * @return FormFieldLink
     */
    public function __construct(
        /*Form*/      $form=null,
        /*FormField*/ $field=null,
        /*int*/       $order=null,
        /*string*/    $groupName=null,
        /*string*/    $groupTitle=null
    )
    {
        $this->_form = $form ;
        $this->_field = $field ;
        $this->_order = $order ;
        $this->_groupName = $groupName ;
        $this->_groupTitle = $groupTitle ;
    }

    /**
     * Getter for the id / primary key
     *
     * @see Object::getId()
     *
     * @return int
     */
    public function getId()
    {
        if (is_null($this->_form) && is_null($this->_field)) {
            return null ;
        } else {
            $id = array();
            if (!is_null($this->_form)) {
                $id["form"] = $this->_form ;
            }
            if (!is_null($this->_field)) {
                $id["field"] = $this->_field ;
            }
            return $id ;
        }
    }

    /**
     * Getter for the form
     * 
     * @return Form
     */
    public function getForm()
    {
        return $this->_form ;
    }

    /**
     * Setter for the form
     * 
     * @param Form $form The form
     * 
     * @return void
     */
    public function setForm(/*Form*/ $form)
    {
        $this->_form = $form ;
    }

    /**
     * Getter for the field
     *
     * @return FormField
     */
    public function getField()
    {
        return $this->_field ;
    }

    /**
     * Setter for the field
     *
     * @param FormField $field The field
     *
     * @return void
     */
    public function setField(/*FormField*/ $field)
    {
        return $this->_field = $field ;
    }

    /**
     * Getter for the order
     *
     * @return int
     */
    public function getOrder()
    {
        return $this->_order ;
    }

    /**
     * Setter for the order
     *
     * @param int $order The order
     *
     * @return void
     */
    public function setOrder(/*int*/ $order)
    {
        $this->_order = $order ;
    }
    
    /**
     * Getter for the group name
     *
     * @return string
     */
    public function getGroupName()
    {
    	return $this->_groupName ;
    }
    
    /**
     * Setter for the group name
     *
     * @param string $groupName The group name
     *
     * @return void
     */
    public function setGroupName(/*string*/ $groupName)
    {
    	$this->_groupName = $groupName ;
    }
    
    /**
     * Getter for the group title
     *
     * @return string
     */
    public function getGroupTitle()
    {
    	return $this->_groupTitle ;
    }
    
    /**
     * Setter for the group title
     *
     * @param string $groupTitle The group title
     *
     * @return void
     */
    public function setGroupTitle(/*string*/ $groupTitle)
    {
    	$this->_groupTitle = $groupTitle ;
    }

    /**
     * Shows the FormFieldLink as a string
     *
     * @see Object::toString()
     *
     * @return string
     */
    public function toString()
    {
        return '' ;
    }

}
